<?php
	include_once("DataProvider.php");
	include_once("../DTO/cauHinhLoaiSPDTO.php");
	
	class cauHinhLoaiSPDAO
	{
		public $sql = "";
		var $cauHinhLoaiSPDTO;
		function __construct()
		{
			return $this->cauHinhLoaiSPDTO = new cauHinhLoaiSPDTO();
		}
		
		public function load()
		{
			$result= DataProvider::ExecuteQuery($this->sql);
			$arrCauHinhLoaiSPDTO = new ArrayObject();
			
			while($row = mysql_fetch_array($result))
			{
				$cauHinhLoaiSPDTO = new cauHinhLoaiSPDTO();
				$cauHinhLoaiSPDTO->idCauHinhLoaiSP = $row['idCauHinhLoaiSP'];
				$cauHinhLoaiSPDTO->tenCauHinh = $row['tenCauHinh'];
				$cauHinhLoaiSPDTO->biXoa = $row['biXoa'];
				$cauHinhLoaiSPDTO->idLoaiSP = $row['idLoaiSP'];
				
				$arrCauHinhLoaiSPDTO[] = $cauHinhLoaiSPDTO;
			}
			return $arrCauHinhLoaiSPDTO;
		}
		
		public function load_CauHinhLoaiSP_All()
		{
			$this->sql= 'select * from cauhinhloaisp';
			$result=$this->Load();
			return $result; 
		}
		
		public function load_CauHinhLoaiSP_One($idCauHinhLoaiSP)
		{
			$this->sql = 'select * from cauhinhloaisp where idCauHinhLoaiSP ='.$idCauHinhLoaiSP;
			$result = $this->load();
			return $result;
		}
		
		public function load_CauHinhLoaiSP()
		{
			$this->sql = 'select * from cauhinhloaisp where biXoa = 0';
			$result = $this->load();
			return $result;
		}
		
		public function load_CauHinhLoaiSP_idLoaiSP($idLoaiSP)
		{
			$this->sql = 'select * from cauhinhloaisp where idLoaiSP ='.$idLoaiSP;
			$result = $this->load();
			return $result;
		}
		

	}
	
?>